package com.sxt;

import java.awt.*;

public abstract class GameObject {
    //游戏元素图片的路径
    String ImagePath;
    //游戏元素的图片
    public Image image;
    //游戏元素的横坐标
    public int x;
    //游戏元素的纵坐标
    public int y;
    //游戏元素的宽
    public int width;
    //游戏元素的高
    public int height;
    //游戏元素的移动速度
    public int speedY;
    //引入主界面
    public GameWin Frame;

    public GameObject(){}

    public GameObject(String image, GameWin frame) {
        this.image = Toolkit.getDefaultToolkit().getImage(image);
        Frame = frame;
        ImagePath = image;
    }

    public GameObject(String image, int x, int y, int speedY, GameWin frame) {
        this.image = Toolkit.getDefaultToolkit().getImage(image);
        this.x = x;
        this.y = y;
        this.speedY = speedY;
        Frame = frame;
        ImagePath = image;
    }

    public GameObject(String image, int x, int y, int width, int height, int speedY, GameWin frame) {
        this.image = Toolkit.getDefaultToolkit().getImage(image);
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.speedY = speedY;
        Frame = frame;
        ImagePath = image;
    }

    public Image getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image =Toolkit.getDefaultToolkit().getImage(image);
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void setLocation(int x, int y){
        this.x = x;
        this.y = y;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public double getSpeed() {
        return speedY;
    }

    public void setSpeed(int speedY) {
        this.speedY = speedY;
    }

    public GameWin getFrame() {
        return Frame;
    }

    public void setFrame(GameWin frame) {
        Frame = frame;
    }
    //继承元素绘制自己的方法
    public abstract void paintSelf(Graphics s);

    //获取当前游戏元素的矩形
    public abstract Rectangle getRec();

    public abstract void DeBug();
}
